#include<future>
#include<thread>
#include<iostream>

int Add(int a,int b)
{
    return a + b;
}

int main()
{
    //创建promise对象
    std::promise<int> pro;
    //获取future
    std::future<int>future = pro.get_future();
    //创建线程指向加法逻辑
    std::thread th([&pro]()
                   { 
                    int sum = Add(30, 30);
                    pro.set_value(sum); 
                   });
    std::cout << future.get() << std::endl;

    th.join();
    return 0;
}